package com.lineng.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.lineng.pojo.Recommend;
import com.lineng.service.RecommendService;

@Controller
public class RecommendController {

	@Autowired
	RecommendService recommendService;

	/**
	 * 为您推荐内容
	 * 
	 * @return
	 */
	@RequestMapping(value = "/getRecommend", method = RequestMethod.GET, produces = "text/json;charset=UTF-8")
	@ResponseBody
	public String getRecommend() {
		List<Recommend> recommends = recommendService.getRecommend();
		return JSON.toJSONString(recommends);

	}

	/**
	 * 更改为你推荐内容
	 * 
	 * @param recommend
	 * @return
	 */
	@RequestMapping(value = "/updateRecommend", method = RequestMethod.POST, produces = "text/json;charset=UTF-8")
	@ResponseBody
	public String updateRecommend(Recommend recommend) {
		return JSON.toJSONString(recommendService.updateRecommend(recommend));

	}

}
